import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

/**
 * 判断线程是否存活
 */
public class ThreadDemoByAlive {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            for (int i = 0; i <10 ; i++) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("1.线程执行完了。");
        });
       t.start();
       while(t.isAlive()){
       }
       System.out.println("2.确定线程执行完了!");
    }
}
